function Config(){
	this.white_domain = ['event.m.shihou.tv', 'resource.youxiduo.com'];//生产环境白名单
	
	this.init();
}
Config.prototype={
	init: function(){
		//根据host判断当前是测试环境还是正式环境
		if(this.checkDomain()){
			this.realBaseUrl();
		}else{
			this.testBaseUrl();
		}
	},
	testBaseUrl: function(){
		console.log('测试环境');
		this.forum_base_url = 'http://112.124.121.34:8091/2017_summer_activities';
		this.forum_list_url = this.forum_base_url + '/forum/query';
		this.forum_fabulous = this.forum_base_url + '/forum/fabulous';
		this.publish_forum = this.forum_base_url + '/forum/add';
		this.check_gift = 'http://test.api.shihou.tv/api/gift/check_sent';//?user_id=1&gift_id=10047
		this.user_batch = 'http://api.shihou.tv/api/user/batch?';
	},
	realBaseUrl: function(){
		console.log('生产环境');
		this.forum_base_url = 'http://event.m.shihou.tv/2017_summer_activities';
		this.forum_list_url = this.forum_base_url + '/forum/query';
		this.forum_fabulous = this.forum_base_url + '/forum/fabulous';
		this.publish_forum = this.forum_base_url + '/forum/add';
		this.check_gift = 'http://api.shihou.tv/api/gift/check_sent';//?user_id=1&gift_id=10047
		this.user_batch = 'http://api.shihou.tv/api/user/batch?';
	},
	//验证domain
	checkDomain: function(){
		var domain = document.domain;
		for (var i = 0;i < this.white_domain.length;i++) {
			var domai = this.white_domain[i];
			if(domain == domai)
				return true;
		}
		return false;
	},
	//获取url中的参数
    getUrlParam: function(name, url) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        url = url || window.location.search.substr(1).match(reg);  //匹配目标参数
        if (url != null) return unescape(url[2]); return null; //返回参数值
    },
    getUrlParams: function(){
    	var url = window.location.href;  //匹配目标参数
    	if(url != null)
    		return url.substr(url.indexOf("?"), url.length);
    }
}